package cc.kzc.adminauth.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class DataSourceConfigurer {

	@Primary
	@Bean(name = "db1DataSource") // 配置该方法返回值为db1管理bean
	@Qualifier("db1DataSource") // spring装配bean唯一标识
	@ConfigurationProperties(prefix = "spring.datasource.db1")
	public DataSource db1DataSource() {
		return DataSourceBuilder.create().build();
	}

//	@Bean(name = "db2DataSource")
//	@Qualifier("db2DataSource")
//	@ConfigurationProperties(prefix = "spring.datasource.db2")
//	public DataSource db2DataSource() {
//		return DataSourceBuilder.create().build();
//	}

//	@Bean(name = "db3DataSource")
//	@Qualifier("db3DataSource")
//	@ConfigurationProperties(prefix = "spring.datasource.db3")
//	public DataSource db3DataSource() {
//		return DataSourceBuilder.create().build();
//	}

}
